import { getToken } from "@/utils/token"
import { Navigate } from "react-router-dom"
// import PropTypes from 'prop-types'

// 路由权限实现
// 封装高阶组件  若未登录，没有token则跳转登录页面
const AuthRoute = ({ children }) => {
    const token = getToken()
    if (token) {
        return <>{ children }</>
    } else {
        return <Navigate to='/login' replace></Navigate>
    }
}

export default AuthRoute
